﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Fjaspx.UI.Web.Administrator.go
{
    public partial class edit_objet : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) { if (Request["id"] != null) { ShowInfo(Convert.ToInt32(Request["id"])); } }
        }
        private void ShowInfo(int id)
        {
            ___ROYcms_Objet_model = ___ROYcms_Objet_bll.GetModel(id);
            this.txtTitle.Text = ___ROYcms_Objet_model.Title;
            this.txtClassKind.Text = ___ROYcms_Objet_model.ClassKind.ToString();
            this.txtzhaiyao.Text = ___ROYcms_Objet_model.zhaiyao;
            this.txtlogo.Text = ___ROYcms_Objet_model.logo;
            this.txtAppendixConfig.Text = ___ROYcms_Objet_model.AppendixConfig;
            this.txtAppendixPath.Text = ___ROYcms_Objet_model.AppendixPath;
            this.txtVisible.Text = ___ROYcms_Objet_model.Visible.ToString();
            this.txtRole.Text = ___ROYcms_Objet_model.Role;
        }

        protected void btnEdit_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request["id"]);
            string Title = this.txtTitle.Text;
            int ClassKind = int.Parse(this.txtClassKind.Text);
            string zhaiyao = this.txtzhaiyao.Text;
            string logo = this.txtlogo.Text;
            string AppendixConfig = this.txtAppendixConfig.Text;
            string AppendixPath = this.txtAppendixPath.Text;
            int Visible = int.Parse(this.txtVisible.Text);
            string Role = this.txtRole.Text;
            DateTime Time = DateTime.Now;
            //if (!___ROYcms_Objet_bll.ExistsClassKind(ClassKind))
            //{
                ___ROYcms_Objet_model.id = id;
                ___ROYcms_Objet_model.Title = Title;
                ___ROYcms_Objet_model.ClassKind = ClassKind;
                ___ROYcms_Objet_model.zhaiyao = zhaiyao;
                ___ROYcms_Objet_model.logo = logo;
                ___ROYcms_Objet_model.AppendixConfig = AppendixConfig;
                ___ROYcms_Objet_model.AppendixPath = AppendixPath;
                ___ROYcms_Objet_model.Visible = Visible;
                ___ROYcms_Objet_model.Role = Role;
                ___ROYcms_Objet_model.Time = Time;

                ___ROYcms_Objet_bll.Update(___ROYcms_Objet_model);
                Response.Redirect("admin_objet.aspx?");
            //}
            //else { Response.Write("标识冲突！不能重复"); }
        }
    }
}
